<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>美食网页</title>
    {% load static %}

    <style>
        /* 通用样式 */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f4f4f9;
            color: #393232;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        /* 导航栏样式 */
        nav {
            background: linear-gradient(135deg, #8a2054, #b12f6e);
            box-shadow: 0 4px 20px rgba(177, 47, 110, 0.2);
            position: sticky;
            top: 0;
            width: 100%;
            z-index: 1000;
        }

        nav ul {
            margin: 0;
            padding: 0;
            list-style: none;
            display: flex;
            justify-content: center;
        }

        nav ul li {
            margin: 10px 20px;
            position: relative;
        }

        nav ul li a {
            color: #fff;
            text-decoration: none;
            font-size: 17px;
            padding: 10px 20px;
            display: block;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 500;
            letter-spacing: 0.8px;
            border-radius: 25px;
        }

        nav ul li a:hover {
            background-color: #575757;
            border-radius: 5px;
        }

        /* 下拉菜单样式 */
        nav ul li .dropdown {
            display: none;
            position: absolute;
            top: 40px;
            left: 0;
            background-color: #333;
            border-radius: 5px;
            padding: 10px 0;
            min-width: 160px;
            z-index: 2000;
        }

        nav ul li:hover .dropdown {
            display: block;
        }

        nav ul li .dropdown a {
            padding: 10px 20px;
            display: block;
            color: white;
            text-decoration: none;
        }

        nav ul li .dropdown a:hover {
            background-color: #575757;
        }

        /* 主体内容 */
        .container {
            background-image: url("{% static 'images/背景x.jpg' %}");
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            width: 100%;
            margin: 0;
            text-align: center;
            flex-grow: 1;
        }

        h1 {
            font-size: 80px;
            font-weight: bold;
            text-shadow: 3px 3px 6px rgba(177, 47, 110, 0.2);
            background: linear-gradient(to left, #b12f6e, #efacd1);
            color: transparent;
            font-family: Arial, Helvetica, sans-serif;
            margin-top: 0px;
            margin-bottom: 1px;
            color: #f5d8f0;
            font-style: italic;
            -webkit-background-clip: text;
            background-clip: text;
            padding: 20px 0;
            position: relative;
            z-index: 1;
        }

        h1::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 4px;
            background: linear-gradient(90deg, #b12f6e, #efacd1);
            border-radius: 2px;
        }

        /* 新增轮播容器样式 */
        .carousel-wrapper {
            background: none;
            backdrop-filter: none;
            border: none;
            animation: none;
            position: relative;
            width: 90vw;
            max-width: 1400px;
            margin: 2% auto;
            perspective: 2500px;
        }

        .image-slider {
            position: relative;
            border-radius: 20px;
            overflow: hidden;
            transform-style: preserve-3d;
            transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
            animation: breathe 6s ease-in-out infinite, borderGlow 4s infinite;
        }

        .slides {
            display: flex;
            transition: transform 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55),
                        filter 0.8s ease;
        }

        .slide {
            flex: 0 0 100%;
            position: relative;
            transform-style: preserve-3d;
            perspective: 1000px;
            filter: blur(2px) grayscale(0.3);
            transition: filter 0.8s ease;
        }

        .slide img {
            width: 100%;
            height: 75vh;
            max-height: 900px;
            object-fit: contain;
            object-position: center;
            transform: scale(0.95);
            filter: brightness(0.9) sepia(0.1);
            transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
            border-radius: 20px;
            padding: 20px;
        }

        .slide.active {
            filter: blur(0) grayscale(0);
        }

        .slide.active img {
            transform: scale(1) rotateY(0deg);
            filter: brightness(1.05) sepia(0);
            box-shadow: 0 0 40px rgba(177, 47, 110, 0.3);
        }

        /* 新增倒影效果 */
        .carousel-reflection {
            position: absolute;
            bottom: -120px;
            width: 100%;
            height: 100px;
            background: linear-gradient(to top, 
                rgba(177, 47, 110, 0.1) 0%,
                rgba(255,255,255,0) 80%);
            transform: scaleY(-1) rotateX(80deg);
            opacity: 0.6;
        }

        /* 增强导航按钮 */
        .prev, .next {
            width: 60px;
            height: 60px;
            background: rgba(255,255,255,0.9);
            color: #b12f6e;
            font-size: 28px;
            backdrop-filter: blur(10px);
            transition: all 0.4s ease;
        }

        .prev:hover, .next:hover {
            transform: translateY(-50%) scale(1.2) rotate(10deg);
            background: #b12f6e;
            color: white;
        }

        /* 动态指示器 */
        .slide-indicators {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 15px;
            z-index: 10;
        }

        .indicator {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: rgba(255,255,255,0.3);
            cursor: pointer;
            transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
            box-shadow: 0 0 10px rgba(177, 47, 110, 0.3);
        }

        .indicator.active {
            background: #b12f6e;
            transform: scale(1.8) rotate(180deg);
        }

        /* 新增拖拽效果 */
        .slides.grabbing {
            cursor: grabbing;
            transition: none;
        }

        footer {
            background: linear-gradient(135deg, #8a2054, #b12f6e);
            color: white;
            text-align: center;
            padding: 20px 0;
            width: 100%;
            border-top: 3px solid #efacd1;
        }

        footer p {
            margin: 0;
            font-size: 14px;
        }

        footer a {
            color: #fff;
            text-decoration: none;
            margin: 0 10px;
            position: relative;
            padding: 5px 10px;
        }

        footer a::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 0;
            height: 2px;
            background: #efacd1;
            transition: width 0.3s ease;
        }

        footer a:hover::after {
            width: 100%;
        }

        /* 新增登录相关样式 */
        .auth-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1001;
        }

        .auth-buttons {
            display: flex;
            gap: 20px;
            padding: 10px;
            background: rgba(255,255,255,0.9);
            border-radius: 30px;
            box-shadow: 0 8px 32px rgba(177, 47, 110, 0.15);
        }

        .auth-btn {
            position: relative;
            overflow: hidden;
            padding: 16px 35px;
            border: none;
            border-radius: 25px;
            font-size: 18px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
            text-decoration: none;
        }

        .login-btn {
            background: linear-gradient(135deg, #b12f6e, #efacd1);
            color: white;
        }

        .signup-btn {
            background: linear-gradient(135deg, #efacd1, #b12f6e);
            color: white;
        }

        .liquid {
            position: absolute;
            width: 120%;
            height: 200%;
            background: rgba(255,255,255,0.15);
            top: -50%;
            left: -10%;
            transform: rotate(15deg);
            transition: all 0.8s ease;
            pointer-events: none;
        }

        .auth-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 12px 24px rgba(177, 47, 110, 0.25);
        }

        .auth-btn:hover .liquid {
            left: 110%;
            transition-delay: 0.2s;
        }

        .auth-btn:active {
            transform: scale(0.95);
        }

        .btn-text {
            position: relative;
            z-index: 2;
            letter-spacing: 1px;
            transition: all 0.3s ease;
        }

        .auth-btn:hover .btn-text {
            letter-spacing: 2px;
        }

        /* 新增表单样式 */
        .form-fields {
            position: relative;
            margin: 20px 0;
        }

        .form-fields label {
            position: absolute;
            left: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #b12f6e;
            transition: all 0.3s ease;
            pointer-events: none;
        }

        .form-fields input:focus + label,
        .form-fields input:not(:placeholder-shown) + label {
            top: -10px;
            left: 5px;
            font-size: 0.8em;
            background: white;
            padding: 0 5px;
        }

        .auth-link {
            text-align: center;
            margin-top: 15px;
            color: #666;
        }

        .auth-link a {
            color: #b12f6e;
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .auth-link a:hover {
            color: #8a2054;
        }

        /* 在原有样式基础上新增注册表单特定样式 */
        .auth-form input::placeholder {
            color: #999;
            font-size: 14px;
        }
        
        .auth-form input[type="email"] {
            text-transform: lowercase;
        }

        /* 错误提示样式 */
        .errorlist {
            color: #e74c3c;
            font-size: 0.9em;
            margin: 5px 0 0 15px;
            list-style: none;
        }

        /* 新增动态遮罩 */
        .dynamic-overlay {
            position: absolute;
            inset: 0;
            background: 
                radial-gradient(circle at 50% 50%, 
                    transparent 40%, 
                    rgba(177, 47, 110, 0.1) 100%),
                repeating-linear-gradient(
                    45deg,
                    transparent 0px,
                    transparent 2px,
                    rgba(255,255,255,0.1) 3px,
                    rgba(255,255,255,0.1) 4px
                );
            pointer-events: none;
            animation: overlayFlow 20s linear infinite;
        }

        @keyframes overlayFlow {
            0% { background-position: 0 0, 0 0; }
            100% { background-position: 100% 100%, 400px 400px; }
        }

        /* 新增卡片悬浮效果 */
        .slide::after {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(45deg, 
                transparent 40%, 
                rgba(255,255,255,0.2) 50%,
                transparent 60%);
            opacity: 0;
            transition: opacity 0.6s ease;
        }

        .slide.active::after {
            opacity: 1;
            animation: lightSweep 3s infinite;
        }

        @keyframes lightSweep {
            0% { background-position: -100% 0; }
            100% { background-position: 200% 0; }
        }

        /* 新增呼吸动画 */
        @keyframes breathe {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        /* 优化指示器动画 */
        .indicator {
            transition: all 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
        }

        .indicator.active {
            transform: scale(1.8) rotate(180deg);
        }

        /* 改进版浮动背景动画 */
        .floating-background {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            pointer-events: none;
            z-index: -1;
            overflow: hidden;
        }

        .floating-particle {
            position: absolute;
            font-size: 2.5vmin;
            opacity: 0;
            animation: float 18s infinite linear;
            filter: drop-shadow(0 2px 5px rgba(177,47,110,0.2));
            transition: all 0.3s ease;
        }

        /* 不同形状的粒子 */
        .floating-particle.circle {
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: radial-gradient(circle at 30% 30%, 
                #ffb3c1, 
                #b12f6e);
        }

        .floating-particle.diamond {
            clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
            background: linear-gradient(45deg, #efacd1, #ffd966);
            width: 20px;
            height: 20px;
        }

        @keyframes float {
            0% {
                transform: 
                    translate(calc(-50vw + var(--x) * 100vw), 120vh)
                    rotate(0deg)
                    scale(0.8);
                opacity: 0.2;
            }
            30% {
                opacity: 0.8;
                transform: scale(1.2) rotate(180deg);
            }
            100% {
                transform: 
                    translate(calc(-50vw + var(--x) * 100vw), -30vh)
                    rotate(720deg)
                    scale(0.6);
                opacity: 0;
            }
        }

        /* 鼠标交互效果 */
        .floating-particle:hover {
            animation-play-state: paused;
            transform: scale(3) rotate(0deg)!important;
            opacity: 1!important;
            filter: drop-shadow(0 0 10px rgba(177,47,110,0.5));
        }

        /* 新增卡片流样式 */
        .card-flow-container {
            position: relative;
            width: 100%;
            height: 70vh;
            margin: 4% 0;
            overflow: hidden;
            perspective: 2000px;
        }

        .card-track {
            display: flex;
            gap: 1.5vw;
            height: 100%;
            transform-style: preserve-3d;
            transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
        }

        .card-item {
            flex: 0 0 26vw;
            height: 100%;
            border-radius: 20px;
            overflow: hidden;
            transform: 
                translateZ(calc(var(--i) * -40px)) 
                rotateY(calc(var(--i) * -3deg))
                scale(calc(0.88 + var(--i) * 0.04));
            transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
            box-shadow: 
                0 15px 35px rgba(177,47,110,0.2),
                0 0 15px rgba(255,255,255,0.1) inset;
            position: relative;
        }

        .card-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            filter: brightness(0.9) contrast(1.1);
            transition: transform 0.4s ease;
        }

        .card-item:hover {
            transform: 
                translateZ(80px) 
                rotateY(0deg)
                scale(1.08);
            box-shadow: 
                0 25px 50px rgba(177,47,110,0.3),
                0 0 30px rgba(255,255,255,0.2) inset;
        }

        .card-item:hover img {
            transform: scale(1.08);
        }

        .card-content {
            position: absolute;
            bottom: 0;
            width: 100%;
            padding: 2rem;
            background: linear-gradient(transparent, rgba(0,0,0,0.7));
            color: white;
            transform: translateY(100%);
            transition: transform 0.3s ease;
        }

        .card-item:hover .card-content {
            transform: translateY(0);
        }

        /* 新增控制条样式 */
        .scroll-controls {
            display: flex;
            align-items: center;
            gap: 2rem;
            width: 60%;
            margin: 2% auto;
        }

        .progress-bar {
            flex-grow: 1;
            height: 4px;
            background: rgba(177, 47, 110, 0.2);
            border-radius: 2px;
            position: relative;
        }

        .progress-bar::after {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 30%;
            background: linear-gradient(90deg, #b12f6e, #efacd1);
            border-radius: 2px;
            transition: width 0.3s ease;
        }

        .scroll-btn {
            width: 50px;
            height: 50px;
            border: none;
            border-radius: 50%;
            background: rgba(255,255,255,0.9);
            color: #b12f6e;
            font-size: 1.5rem;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 8px 20px rgba(177, 47, 110, 0.2);
        }

        .scroll-btn:hover {
            background: #b12f6e;
            color: white;
            transform: scale(1.1);
        }
    </style>
</head>
<body>

    <!-- 导航栏 -->
    <nav>
        <ul>
            <li><a href="#">首页</a></li>
            <li><a href="#">关于我们</a></li>
            <li>
                <a href="#">服务</a>
                <!-- 下拉菜单 -->
                <div class="dropdown">
                    <!-- 修改美食种类链接 -->
                    <a href="{% url 'index' %}?service=food-type">美食种类</a>
                    <a href="{% url 'page2' %}?service=regional-food">地区美食</a>
                    <a href="{% url 'page2' %}?service=cooking-method">制作方式</a>
                </div>
            </li>
            <li><a href="#">联系</a></li>
        </ul>
    </nav>

    <!-- 页面内容 -->
    <div class="container">
        <h1>Culinary Gallery</h1>

        <!-- 新增卡片流容器 -->
        <div class="card-flow-container">
            <div class="card-track">
                <!-- 第一组卡片 -->
                <div class="card-item" style="--i:1">
                    <img src="{% static 'images/cake3.jpg' %}" alt="Cake">
                    <div class="card-content">
                        <h3>甜蜜诱惑</h3>
                        <p>法式经典甜点</p>
                    </div>
                </div>
                <!-- 更多卡片项... -->
            </div>
            
            <!-- 克隆卡片组实现无限滚动 -->
            <div class="card-track" aria-hidden="true"></div>
        </div>

        <!-- 新增控制条 -->
        <div class="scroll-controls">
            <button class="scroll-btn prev-btn" onclick="scrollCards('prev')">‹</button>
            <div class="progress-bar"></div>
            <button class="scroll-btn next-btn" onclick="scrollCards('next')">›</button>
        </div>
    </div>

    <!-- 页脚 -->
    <footer>
        <p>© 2025 食神网页. <a href="#">隐私政策</a> | <a href="#">条款与条件</a></p>
    </footer>

    <!-- 轮播的 JavaScript -->
    <script>
        // 修改后的卡片滚动逻辑
        let currentScroll = 0;
        const cardWidth = 26; // 每个卡片的宽度（vw）
        const gap = 1.5;     // 卡片间距（vw）
        let totalCards = document.querySelectorAll('.card-item').length;

        function scrollCards(direction) {
            const container = document.querySelector('.card-flow-container');
            const track = document.querySelector('.card-track');
            
            // 计算最大可滚动范围
            const maxScroll = -((totalCards - 1) * (cardWidth + gap));
            
            if (direction === 'next') {
                currentScroll = Math.max(currentScroll - (cardWidth + gap), maxScroll);
            } else {
                currentScroll = Math.min(currentScroll + (cardWidth + gap), 0);
            }
            
            // 添加平滑动画
            track.style.transition = 'transform 0.8s cubic-bezier(0.23, 1, 0.32, 1)';
            track.style.transform = `translateX(${currentScroll}vw)`;
            
            // 更新进度条
            updateProgressBar();
            
            // 重置过渡效果
            setTimeout(() => {
                track.style.transition = 'none';
                // 实现无限循环
                if (currentScroll <= maxScroll) {
                    currentScroll = 0;
                    track.style.transform = `translateX(${currentScroll}vw)`;
                }
            }, 800);
        }

        function updateProgressBar() {
            const progress = document.querySelector('.progress-bar');
            const progressWidth = ((Math.abs(currentScroll) / (cardWidth + gap)) / (totalCards - 1)) * 100;
            progress.style.width = `${Math.min(progressWidth, 100)}%`;
        }

        // 初始化进度条
        updateProgressBar();

        // 增强轮播逻辑
        let isDragging = false;
        let startPosX = 0;
        let currentTranslate = 0;
        let prevTranslate = 0;
        let animationID = 0;
        let currentIndex = 0;

        const slider = document.querySelector('.slides');
        const slides = document.querySelectorAll('.slide');

        // 触摸事件
        slider.addEventListener('touchstart', touchStart);
        slider.addEventListener('touchmove', touchMove);
        slider.addEventListener('touchend', touchEnd);

        // 鼠标事件
        slider.addEventListener('mousedown', mouseStart);
        slider.addEventListener('mousemove', mouseMove);
        slider.addEventListener('mouseup', mouseEnd);
        slider.addEventListener('mouseleave', mouseEnd);

        function getPositionX(event) {
            return event.type.includes('mouse') ? event.pageX : event.touches[0].clientX;
        }

        function touchStart(e) {
            startPosX = getPositionX(e);
            slider.classList.add('grabbing');
        }

        function touchMove(e) {
            if (isDragging) {
                const currentPosition = getPositionX(e);
                currentTranslate = prevTranslate + currentPosition - startPosX;
            }
        }

        function touchEnd() {
            slider.classList.remove('grabbing');
            const movedBy = currentTranslate - prevTranslate;
            if (movedBy < -100) showNext();
            if (movedBy > 100) showPrev();
            prevTranslate = currentTranslate;
        }

        // 类似实现mouseStart/mouseMove/mouseEnd...

        // 增强动画效果
        function showNext() {
            currentIndex = (currentIndex + 1) % slides.length;
            triggerLightEffect();
            updateSlider();
        }

        function showPrev() {
            currentIndex = (currentIndex - 1 + slides.length) % slides.length;
            triggerLightEffect();
            updateSlider();
        }

        function updateSlider() {
            slider.style.transform = `translateX(-${currentIndex * 100}%)`;
            // 新增卡片切换动画
            slides.forEach((slide, i) => {
                slide.classList.toggle('active', i === currentIndex);
                if(i === currentIndex) {
                    slide.animate([
                        { transform: 'scale(0.98)', opacity: 0.8 },
                        { transform: 'scale(1)', opacity: 1 }
                    ], { duration: 600, easing: 'ease-out' });
                }
            });
            document.querySelectorAll('.indicator').forEach((ind, i) => {
                ind.classList.toggle('active', i === currentIndex);
            });
        }

        // 自动旋转
        setInterval(() => {
            if (!isDragging) showNext();
        }, 5000);

        // 初始化指示器
        slides.forEach((_, i) => {
            const indicator = document.createElement('div');
            indicator.className = `indicator ${i === 0 ? 'active' : ''}`;
            indicator.addEventListener('click', () => gotoSlide(i));
            document.querySelector('.slide-indicators').appendChild(indicator);
        });

        function gotoSlide(index) {
            currentIndex = index;
            updateSlider();
        }

        // 新增鼠标跟随效果
        document.querySelector('.image-slider').addEventListener('mousemove', (e) => {
            const rect = e.currentTarget.getBoundingClientRect();
            const x = (e.clientX - rect.left) / rect.width;
            const y = (e.clientY - rect.top) / rect.height;
            
            slider.style.transform = `translateX(-${currentIndex * 100}%) 
                rotateX(${(y - 0.5) * 4}deg) 
                rotateY(${(x - 0.5) * 4}deg)`;
        });

        document.querySelector('.image-slider').addEventListener('mouseleave', () => {
            slider.style.transform = `translateX(-${currentIndex * 100}%)`;
        });

        function triggerLightEffect() {
            const activeSlide = document.querySelector('.slide.active');
            if(activeSlide) {
                activeSlide.style.animation = 'none';
                void activeSlide.offsetWidth; // 触发重绘
                activeSlide.style.animation = null;
            }
        }

        // 新增卡片流交互逻辑
        const track = document.querySelector('.card-track');
        const progress = document.querySelector('.progress-bar');
        let isScrolling = false;
        let momentum = 0;
        let scrollRequest = 0;
        
        // 初始化克隆卡片
        function cloneCards() {
            const cloneTrack = track.cloneNode(true);
            cloneTrack.querySelectorAll('.card-content').forEach(c => c.remove());
            document.querySelector('.card-flow-container').appendChild(cloneTrack);
        }
        cloneCards();

        // 鼠标滚轮控制
        let wheelTimeout;
        window.addEventListener('wheel', (e) => {
            clearTimeout(wheelTimeout);
            if (Math.abs(e.deltaY) > 5) {
                scrollCards(e.deltaY > 0 ? 'next' : 'prev');
                wheelTimeout = setTimeout(() => {}, 800);
            }
        });

        // 新增触摸滑动支持
        let touchStartX = 0;
        track.addEventListener('touchstart', e => {
            touchStartX = e.touches[0].clientX;
            cancelAnimationFrame(scrollRequest);
        });
        track.addEventListener('touchmove', e => {
            const deltaX = e.touches[0].clientX - touchStartX;
            track.style.transform = `translateX(${currentScroll - deltaX/3}vw)`;
        });
        track.addEventListener('touchend', e => {
            const deltaX = e.changedTouches[0].clientX - touchStartX;
            if (Math.abs(deltaX) > 50) {
                scrollCards(deltaX > 0 ? 'prev' : 'next');
            }
        });
    </script>

    <!-- 修改auth-container部分 -->
    <div class="auth-container">
        <div class="auth-buttons">
            <a href="{% url 'login' %}" class="auth-btn login-btn">
                <span class="btn-text">登录</span>
                <div class="liquid"></div>
            </a>
            <a href="{% url 'signup' %}" class="auth-btn signup-btn">
                <span class="btn-text">注册</span>
                <div class="liquid"></div>
            </a>
        </div>
    </div>

    <!-- 修改漂浮元素结构 -->
    <div class="floating-background">
        <!-- 生成50个随机粒子 -->
        {% for i in "x"|rjust:"50" %}
        <div class="floating-particle 
                   {% cycle 'circle' 'diamond' %}"
             style="--x: {{ forloop.counter|divisibleby:2|yesno:'0.3,0.7' }};
                    --delay: {{ forloop.counter0|divisibleby:3|yesno:'2,5,8' }}s;
                    animation-delay: {{ forloop.counter0 }}s;
                    left: {% widthratio forloop.counter0 1 2 %}%;
                    animation-duration: {{ 15|add:forloop.counter }}s">
            {% cycle '🍰' '🍩' '🍮' '🍧' '🍨' '🥮' '🍥' '🎂' %}
        </div>
        {% endfor %}
    </div>

    <!-- 新增动态初始化粒子参数 -->
    <script>
    // 动态初始化粒子参数
    document.querySelectorAll('.floating-particle').forEach(particle => {
        // 随机水平起始位置
        particle.style.setProperty('--x', Math.random().toFixed(2));
        
        // 随机动画参数
        particle.style.animationDuration = `${15 + Math.random() * 15}s`;
        particle.style.animationDelay = `-${Math.random() * 20}s`;
        
        // 随机颜色
        const hue = 330 + Math.random() * 30;
        particle.style.backgroundColor = `hsl(${hue}, 70%, 75%)`;
    });

    // 所有页面通用，可放入单独JS文件
    </script>

</body>
</html>
